import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login/Login.vue'
import Home from '@/views/login/Home.vue'
import User from '@/components/User/User.vue'
import CarList from '@/views/cars/carList'
import CarEcharts from '@/views/cars/carEcharts'
import Coupons from '@/views/coupons/coupons'
import CouponsEcharts from '@/views/coupons/couponsEcharts'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/home',
    component: Home,
    redirect: '/users',
    children: [
      {
        path: '/users',
        component: User
      },
      {
        path: '/cars',
        component: CarList
      },
      {
        path: '/carsEcharts',
        component: CarEcharts
      },
      {
        path: '/coupons',
        component: Coupons
      },
      {
        path: '/couponsEcharts',
        component: CouponsEcharts
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
